#include "utils/std.h"
#include "utils/file.h"
#include "oid.h"
#include "cmd.h"
#include "config.h"

void git_init(int argc, char *argv[])
{
    int error=0;
    git_repository *repo = NULL;
    char *repo_path = ".";
    if(argc>1){
        repo_path = argv[1];
    }
    if((error = git_libgit2_init())<0) {
        fprintf(stdeer,"Failed to initialize libgit2");
        exit(EXIT_FAILURE);
    }
    if((error = git_repository_init(&repo,repo_path,0))<0){
        fprintf(stderr, "Failed to initialize repository");
        git_libgit2_shutdown();
        exit(EXIT_FAILURE);
    }

    printf("Initialized empty Git repository in %s\n", repo_path);
    git_repository_free(repo);
    git_libgit2_shutdown();
}
